package pers.cz.postgirl.core.db.redis;

import redis.clients.jedis.JedisPool;

/**
 * @program: postgirl-collection-client
 * @description: redis池工厂
 * @author: Cheng Zhi
 * @create: 2022-07-29 17:46
 **/
public class RedisPoolFactory {

    static JedisPool jedisPool;

    private RedisPoolFactory() {
        // 不允许随便new
    }
    /**
     * 使用双重检查锁
     * @return
     */
    public static synchronized JedisPool getJedisPool() {

        if (jedisPool == null) {
            jedisPool = new RedisConfig().redisPoolFactory();
        }

        return jedisPool;
    }
}
